// JavaScript Document
$(document).ready(function() {
    //登陆框
    $('#loginbtn').click(function() {
        $("#errmsg").html('');
        var username = $('#username').val();
        var password = $('#password').val();
        if (username == "") {
            $("#errmsg").html("用户名不能为空！");
            $("username").focus();
            return false;
        }
        if (password == "") {
            $("#errmsg").html("请输入密码！");
            $("password").focus();
            return false;
        }
        if (username != "" && password != '') {
            //location.href = '/';
            $.post('/account/ajaxlogin/', $("#loginform").serialize(), function(data) {
                if (data.type == 'success') {
                    $("#success").show();
                    setTimeout(function() {
                        $("#success").hide();
                        window.location.reload();
                    }, 1000);
                } else if (data.type == 'error') {
                    $("#errmsg").html(data.msg);
                }
            }, "json");
        }
    });
    $("#services_ul li").hover(function() {
        $(".services_ico div", this).stop().animate({
            "opacity": "1"
        }, 300);
    }, function() {
        $(".services_ico div", this).stop().animate({
            "opacity": "0"
        }, 300);
    })
    $('.flexslider').flexslider({
        directionNav: false,
        animation: "slide"
    });
});
